package com.itWaiLong.Controller.post;

import com.itWaiLong.Dao.Entities.addPostEntities;
import com.itWaiLong.Dao.tech_discussion;
import com.itWaiLong.Result.Result;
import com.itWaiLong.Service.PostService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/post/add")
public class AddPostController {

    @Autowired
    private PostService postService;

    /**
     * 添加讨论主题
     * @param addPostEntities
     * @return
     */
    @PostMapping
    public Result add(@RequestBody addPostEntities addPostEntities){
        log.info("讨论内容：{}",addPostEntities);
        postService.add(addPostEntities);
        return Result.success();
    }
}
